<template>
  <div class="edit-card-dialog">
    <el-dialog :visible.sync="dialogVisible" :before-close="handleClose" width="880px">
      <div class="title" slot="title">{{cardInfo.name?'编辑会员卡':'新增会员卡'}}</div>
      <div class="edit-content">
        <div class="line">
          <div class="line-item">
            <div class="label"><span class="required">*</span><span>会员等级</span></div>
            <div class="input">
              <el-select v-model="memberLevel" placeholder="请选择" style="width: 100%">
                <el-option v-for="item in cardRank" :key="item.value" :label="item.label" :value="item.value"/>
              </el-select>
            </div>
          </div>
          <div class="line-item">
            <div class="label"><span class="required">*</span><span>会员卡名称</span></div>
            <div class="input">
              <el-input v-model="cardInfo.name"/>
            </div>
          </div>
        </div>
        <div class="line">
          <div class="line-item">
            <div class="label"><span class="required">*</span><span>最低消费金额</span></div>
            <div class="input">
              <el-input v-model="cardInfo.amount"/>
            </div>
            <div style="margin-left: 10px">
              <el-checkbox v-model="checked">开启</el-checkbox>
            </div>
          </div>
          <div class="line-item">
            <div class="label"><span class="required">*</span><span>升级条件</span></div>
            <div class="input points">
              <span>累计积分达</span>
              <el-input v-model="cardInfo.points" style="width: 65px;margin-left: 5px"/>
              <span style="margin-left: 5px">自动升级到本卡</span>
            </div>
          </div>
        </div>
        <div class="discount-desc">*折扣设置：9.5折输入9.5，8折输入8，必须大于0和小于等于10</div>
        <div class="line1">
          <div class="line-item">
            <div class="label"><span>挂号</span></div>
            <div class="input">
              <el-input v-model="cardInfo.guahao"/>
            </div>
          </div>
          <div class="line-item">
            <div class="label"><span>诊疗</span></div>
            <div class="input">
              <el-input v-model="cardInfo.zhenliao"/>
            </div>
          </div>
          <div class="line-item">
            <div class="label"><span>西药/成药</span></div>
            <div class="input">
              <el-input v-model="cardInfo.medicine"/>
            </div>
          </div>
        </div>
        <div class="line1">
          <div class="line-item">
            <div class="label"><span>中药颗粒</span></div>
            <div class="input">
              <el-input v-model="cardInfo.zhongyao"/>
            </div>
          </div>
          <div class="line-item">
            <div class="label"><span>中药饮片</span></div>
            <div class="input">
              <el-input v-model="cardInfo.zhongyaoyp"/>
            </div>
          </div>
          <div class="line-item">
            <div class="label"><span>治疗理疗</span></div>
            <div class="input">
              <el-input v-model="cardInfo.zhiliao"/>
            </div>
          </div>
        </div>
        <div class="line1">
          <div class="line-item">
            <div class="label"><span>注射输液</span></div>
            <div class="input">
              <el-input v-model="cardInfo.shuye"/>
            </div>
          </div>
          <div class="line-item">
            <div class="label"><span>加工</span></div>
            <div class="input">
              <el-input v-model="cardInfo.jiagong"/>
            </div>
          </div>
          <div class="line-item">
            <div class="label"><span>其他</span></div>
            <div class="input">
              <el-input v-model="cardInfo.others"/>
            </div>
          </div>
        </div>
        <div class="line" style="margin-top: 40px">
          <div class="line-item">
            <div class="label"><span>自定义权益</span></div>
            <div class="input1"><el-input v-model="cardInfo.profits"/></div>
            <div class="addi-info">请输入特价产品的优惠信息</div>
          </div>
        </div>
        <div class="line">
          <div class="line-item">
            <div class="label"><span class="required">*</span><span>状态</span></div>
            <div class="input1">
              <el-select v-model="cardStatus" placeholder="请选择">
                <el-option v-for="item in cardStatusList" :key="item.value" :label="item.label" :value="item.value"/>
              </el-select>
            </div>
          </div>
        </div>
      </div>
      <div class="btn">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: 'editCard',
  props: {
    cardInfo: {
      type: Object
    }
  },
  data () {
    return {
      dialogVisible: false,
      checked: false,
      memberLevel: '',
      cardRank: [
        { value: 'guibing', label: '贵宾' },
        { value: 'normal', label: '普通' }
      ],
      cardStatus: '',
      cardStatusList: [
        { value: 'close', label: '关闭' }
      ]
    }
  },
  methods: {
    show () {
      this.dialogVisible = true
    },
    handleClose () {
      this.dialogVisible = false
    }
  }
}
</script>

<style scoped lang="scss">
.edit-card-dialog {
  font-size: 14px;

  .title {
    border-bottom: 1px solid #e5e1e1;
    padding-bottom: 10px;
    font-weight: bold;
    font-size: 16px;
  }

  .edit-content {
    margin-top: -30px;

    .line {
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-top: 20px;

      .line-item {
        display: flex;
        align-items: center;

        .label {
          width: 100px;
          text-align: right;

          .required {
            color: red;
          }
        }

        .input {
          margin-left: 10px;
          width: 250px;
        }

        .input1{
          margin-left: 10px;
          width: 400px;
        }

        .el-select{
          display: block;
        }

        .addi-info{
          font-size: 12px;
          color: rgba(0,0,0,0.45);
          margin-left: 5px
        }

        .points {
          display: flex;
          align-items: center;

          span {
            color: #FF6E33;
          }
        }
      }
    }

    .discount-desc {
      color: #FF3030;
      margin: 40px 0 0 45px;
    }

    .line1 {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin: 20px 80px 0 0;

      .line-item {
        display: flex;
        align-items: center;

        .label {
          width: 100px;
          text-align: right;
        }

        .input {
          margin-left: 10px;
          width: 90px;
        }
      }
    }
  }

  .btn {
    display: flex;
    justify-content: center;
    margin-top: 20px;
  }
}
</style>
